package com.zhiyou100.poly2;

public class Test {


    public static void main(String[] args) {

        Ostrich ostrich = new Ostrich();
        ostrich.color = "灰色";
        ostrich.love = "跑步";
        ostrich.fly();

        Pigeon pigeon = new Pigeon();
        pigeon.fly();

        //在继承基础之上，对象可以转型
        Bird bird = ostrich;   //向上转型
        bird.color = "黑白色";
        bird.love = "跑步";
        //此时fly是子类的   因为此时bird指向的是子类对象的地址
        bird.fly();
//        bird.sport();

        bird = pigeon;
        bird.fly();  //Pigeon的fly
//        bird.height = 20;
    }

}
